package acewem.utilities.io;

import java.io.*;

public class WriteToCSV {
	
	public WriteToCSV(){
		try{
			// Create file 
			FileWriter fstream = new FileWriter("c:\\test.csv",false);
			BufferedWriter out = new BufferedWriter(fstream);
			out.close();
		}catch (Exception e){//Catch exception if any
			System.err.println("Error: " + e.getMessage());
		}
	}
	
	public void writeToCSV(double[] cumulativeLMP)
	{
		try{
			// Create file 
			FileWriter fstream = new FileWriter("c:\\test.csv",true);
			BufferedWriter out = new BufferedWriter(fstream);
			
			for (int i = 0; i<cumulativeLMP.length; i++)
			{
			out.write(Double.toString(cumulativeLMP[i]/24));
			out.append(',');
			}
			out.newLine();
			//Close the output stream
			out.close();
		}catch (Exception e){//Catch exception if any
			System.err.println("Error: " + e.getMessage());
		}
	}
 }